package com.liohi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liohi.entity.Dictionary;
import com.liohi.service.DictionaryService;
import com.liohi.mapper.DictionaryMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
* @author liohi
* @description 针对表【dictionary】的数据库操作Service实现
* @createDate 2023-08-02 15:10:31
*/
@Service
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary>
    implements DictionaryService{

    @Override
    public List<String> getCodeNameByTypeCode(String typecode) {
        List<String> codeNameList = new ArrayList<>();
        List<Dictionary> dictionaries = baseMapper.selectList(new QueryWrapper<Dictionary>().eq("typecode", typecode));

        for (Dictionary dictionary : dictionaries) {
            codeNameList.add(dictionary.getCodename());
        }
        return codeNameList;
    }
}




